package logger

import (
	"os"
	"sync"

	"go.uber.org/zap"
	"go.uber.org/zap/zapcore"
)

var (
	cmd     *zap.Logger
	fs      *zap.Logger
	cmdOnce sync.Once
	fsOnce  sync.Once
)

func GetCMDLogger() *zap.Logger {
	cmdOnce.Do(func() {
		encoder := getCMDEncode()
		writer := zapcore.AddSync(os.Stdout)
		core := zapcore.NewCore(encoder, writer, zapcore.DebugLevel)
		cmd = zap.New(core, zap.AddCaller())
		zap.NewProduction()
	})
	return cmd
}

func GetFileLogger() *zap.Logger {
	fsOnce.Do(func ()  {
		// todo
	})
	return fs
}
